{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Predicted: [ 10.0625], Target: [11]\n",
      "R-squared: 0.77\n",
      "Predicted: [ 10.28125], Target: [8.5]\n",
      "R-squared: 0.77\n",
      "Predicted: [ 13.09375], Target: [15]\n",
      "R-squared: 0.77\n",
      "Predicted: [ 18.14583333], Target: [18]\n",
      "R-squared: 0.77\n",
      "Predicted: [ 13.3125], Target: [11]\n",
      "R-squared: 0.77\n"
     ]
    }
   ],
   "source": [
    "from sklearn.linear_model import LinearRegression\n",
    "\n",
    "X = [[6, 2], [8, 1], [10, 0], [14, 2], [18, 0]]\n",
    "y = [[7], [9], [13], [17.5], [18]]\n",
    "model = LinearRegression()\n",
    "model.fit(X, y)\n",
    "X_test = [[8, 2], [9, 0], [11, 2], [16, 2], [12, 0]]\n",
    "y_test = [[11], [8.5], [15], [18], [11]]\n",
    "predictions = model.predict(X_test)\n",
    "for i, prediction in enumerate(predictions):\n",
    "    print('Predicted: %s, Target: %s' % (prediction, y_test[i]))\n",
    "    print('R-squared: %.2f' % model.score(X_test, y_test))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
